export default {
  namespaced: true,
  state () {
    return {
      // 写数据的地方
      cartList: [
        { id: 1, name: '皮鞋', price: 9.9 },
        { id: 2, name: '凉鞋', price: 7699 },
        { id: 3, name: '外套', price: 2399 },
        { id: 4, name: '斜挎包', price: 17900 }
      ]
    }
  },
  getters: {
    totalPrice (state) {
      return state.cartList.reduce((sum, v) => (sum += v.price), 0)
    }
  },
  mutations: {
    fn () {
      console.log('cart里的fn')
    }
  },
  actions: {}
}
